<?php namespace Common\Model;
use Hdphp\Model\Model;
class Tag extends Model{
	protected $table = 'tag';
	
	protected $validate = array(
		array('tname','required','标签名称必填',3,3)
	);
	
	public function store(){
		if($this->create()){
			//把字符串变为数组，可以循环
			$tnameArr = explode('|', Q('post.tname'));
			//p($tnameArr);//打印看一下
			//循环多个标签的数据
			foreach ($tnameArr as $v) {
				//依次添加
				$this->add(array('tname'=>$v));
			}
			return true;
		}
		return false;
	}
}



 ?>